<div class="layui-side layui-bg-black">
	<div class="layui-side-scroll">
		<#include "/apps/business/xiaoe/include/left.html">
	</div>
</div>
<div class="layui-body">
	<div class="layui-side-scroll">
		<div class="row" style="height:100%;">
			<div class="col-lg-3" style="border-right:1px solid #e6e6e6;padding-right:0px;">
				<h1 class="site-h1" style="background-color:#FFFFFF;">
					场景
					<span style="float:right;">
						<button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/scene/type/add.html" data-toggle="ajax" data-height="200" data-width="550" data-title="新建分类">
							新建场景
						</button>
					</span>
				</h1>
				<div class="row">
					<div class="col-lg-12">
						<ul>
							<li class="uk_role <#if !curtype??>this</#if>">
								<a href="/apps/xiaoe/scene.html">
									<i class="kfont">&#xe66c;</i>
									默认
								</a>
							</li>
							<#if sceneTypeList??>
							<#list sceneTypeList as sceneType>
							<#if !(sceneType.area??) || sceneType.area == "">
							<li class="uk_role <#if curtype ?? && curtype.id == sceneType.id>this</#if>">
								<a href="/apps/xiaoe/scene.html?type=${sceneType.id!''}">
									<i class="kfont">&#xe66c;</i>
									${sceneType.name!''}
								</a>
							</li>
							</#if>
							</#list>
							</#if>
						</ul>
						<#if areaList?? && areaList?size gt 0>
						<div class="layui-collapse">
							<#list areaList as area>
						    <div class="layui-colla-item">
							    <h2 class="layui-colla-title">${area.name!''}</h2>
							    <div class="layui-colla-content layui-show" style="padding:0px;">
							    	<ul>
									<#if sceneTypeList??>
									<#list sceneTypeList as sceneType>
									<#if sceneType.area?? && sceneType.area?index_of(area.id) gte 0>
									<li class="uk_role <#if curtype?? && curtype.id == sceneType.id>this</#if>" style="padding:5px;">
										<a href="/apps/xiaoe/scene.html?type=${sceneType.id!''}">
											<i class="kfont">&#xe66c;</i>
											${sceneType.name!''}
										</a>
									</li>
									</#if>
									</#list>
									</#if>
								</ul>
							    </div>
							</div>
						    </#list>
						</div>
						</#if>
					</div>
				</div>
			</div>
			<div class="col-lg-9">
				<h1 class="site-h1" style="background-color:#FFFFFF;">
					“<#if curtype??>${curtype.name!''}<#else>默认</#if>”场景下的对话条目<#if topicList??>（${topicList.totalElements!''}）</#if>
					<div class="ukefu-bt-text-content" style="position: absolute;right: 5px;top: 0px;">
						<#if curtype??>
						<button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/scene/type/edit.html<#if curtype??>?type=${curtype.id}</#if>" data-toggle="ajax" data-width="550" data-height="260" data-title="编辑场景">
							编辑场景
						</button>
						<button class="layui-btn layui-btn-sm layui-btn-danger" href="/apps/xiaoe/scene/type/delete.html<#if curtype??>?id=${curtype.id!''}&type=${curtype.id}</#if>" data-toggle="tip" data-title="删除场景前，请确认场景下没有对话条目，请确认是否删除？">
							删除场景
						</button>
						</#if>
						<button class="layui-btn layui-btn-sm green" href="/apps/xiaoe/scene/add.html<#if curtype??>?type=${curtype.id}</#if>" data-toggle="ajax" data-width="950" data-height="550" data-title="添加场景下的对话条目">
							添加场景下的对话条目
						</button>
					</div>
				</h1>
				<div class="row" style="padding:5px;">
					<div class="col-lg-12">
						<table class="layui-table" lay-skin="line">
						  <thead>
							<tr>
							  <th>标题</th>
							  <th>回答策略</th>
							  <th>多轮对话</th>
							  <th>用户输入</th>
							  <th style="white-space:nowrap;" nowrap="nowrap" style="width:1%">操作</th>
							</tr> 
						  </thead>
						  <tbody>
						  	<#if sceneList?? && sceneList.content??>
						  	<#list sceneList.content as scene>
							<tr>
							  <td class="ukefu_topic_title">
									<#if scene.accept?? && scene.accept == true>
							  			<a href="/apps/xiaoe/mrounds/index.html?id=${scene.id!''}&type=scene">
							  		</#if>
									${(scene.title!'')?no_esc}
									<#if scene.allowask?? && scene.allowask == true>
										</a>
									</#if>
							  </td>
							  
							  <td class="ukefu_topic_title">
									<#if scene.replaytype?? && scene.replaytype == "random">随机</#if>
									<#if scene.replaytype?? && scene.replaytype == "order">顺序</#if>
							  </td>
							  
							  <td class="ukefu_topic_title">
									<#if scene.allowask?? && scene.allowask == true>
										<i class="layui-icon" style="color:#19a55d;">&#xe605;</i>
									</#if>
							  </td>
							  
							  <td class="ukefu_topic_title">
									${scene.userinput!''}
							  </td>
							  
							  <td style="white-space: nowrap;width:1%;">
							  		<a href="/apps/xiaoe/scene/edit.html?id=${scene.id!''}<#if curtype??>&type=${curtype.id}</#if>" data-toggle="ajax" data-width="950" data-height="550">
							  			<i class="layui-icon">&#xe642;</i>
							  			编辑
							  		</a>
							  		<a href="/apps/xiaoe/scene/delete.html?id=${scene.id!''}<#if curtype??>&type=${curtype.id}</#if>" data-toggle="tip" data-title="请确认是否删除知识条目？">
							  			<i class="layui-icon" style="color:red;">ဆ</i>
							  			移除
							  		</a>
							  </td>
							</tr>
							</#list>
							</#if>
						  </tbody>
						</table>
					</div> 	   
				</div>
				<div class="row" style="padding:5px;">
					<div class="col-lg-12" id="page" style="text-align:center;"></div>
				</div>
			</div>	
		</div>
	</div>
</div>
<script>
	layui.use(['laypage', 'layer'], function(){
		  var laypage = layui.laypage
		  ,layer = layui.layer;
		  
		  laypage.render({
				elem: 'page'
				,pages: <#if sceneList??>${sceneList.totalPages}<#else>0</#if> //总页数
				,curr:<#if sceneList??>${sceneList.number+1}<#else>0</#if>
				,groups: 5 //连续显示分页数
				,jump:function(data , first){
					if(!first){
						location.href = "/apps/xiaoe/scene.html?<#if q??>q=${q?url}&</#if><#if curtype??>type=${curtype.id}&</#if>p="+data.curr ;
					}
				}
		   });
		});
</script>